package cn.iocoder.yudao.module.biz.dal.mysql.emergencyReservePlainP;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.biz.controller.admin.emergencyReservePlainP.vo.BizEmergencyReservePlainPExportReqVO;
import cn.iocoder.yudao.module.biz.controller.admin.emergencyReservePlainP.vo.BizEmergencyReservePlainPPageReqVO;
import cn.iocoder.yudao.module.biz.dal.dataobject.emergencyReservePlainP.BizEmergencyReservePlainPDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 应急人员 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface BizEmergencyReservePlainPMapper extends BaseMapperX<BizEmergencyReservePlainPDO> {

    default PageResult<BizEmergencyReservePlainPDO> selectPage(BizEmergencyReservePlainPPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BizEmergencyReservePlainPDO>()
                .likeIfPresent(BizEmergencyReservePlainPDO::getName, reqVO.getName())
                .likeIfPresent(BizEmergencyReservePlainPDO::getDeptName, reqVO.getDeptName())
                .eqIfPresent(BizEmergencyReservePlainPDO::getDuty, reqVO.getDuty())
                .eqIfPresent(BizEmergencyReservePlainPDO::getPhone, reqVO.getPhone())
                .eqIfPresent(BizEmergencyReservePlainPDO::getStation, reqVO.getStation())
                .eqIfPresent(BizEmergencyReservePlainPDO::getDeptId, reqVO.getDeptId())
                .betweenIfPresent(BizEmergencyReservePlainPDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
                .orderByDesc(BizEmergencyReservePlainPDO::getId));
    }

    default List<BizEmergencyReservePlainPDO> selectList(BizEmergencyReservePlainPExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<BizEmergencyReservePlainPDO>()
                .likeIfPresent(BizEmergencyReservePlainPDO::getName, reqVO.getName())
                .likeIfPresent(BizEmergencyReservePlainPDO::getDeptName, reqVO.getDeptName())
                .eqIfPresent(BizEmergencyReservePlainPDO::getDuty, reqVO.getDuty())
                .eqIfPresent(BizEmergencyReservePlainPDO::getPhone, reqVO.getPhone())
                .eqIfPresent(BizEmergencyReservePlainPDO::getStation, reqVO.getStation())
                .eqIfPresent(BizEmergencyReservePlainPDO::getDeptId, reqVO.getDeptId())
                .betweenIfPresent(BizEmergencyReservePlainPDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
                .orderByDesc(BizEmergencyReservePlainPDO::getId));
    }

}
